package com.wc.AlgoOJ.DPE003_光头强的假期;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congege
 * @Description
 * @Date Created in 2024/2/3-9:12
 * http://43.138.190.70:8888/p/DPE003
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 100010;
    // f[i][j] 表示当前i以及i以前的天数中，第i天选择j物品的最大价值
    // 第i天选择j,那第i-1天就不能选j，只能从f[i][k] k != j 中选择
    static int[][] f = new int[N][3];
    static int[][] a = new int[N][3];
    static int n;

    public static void main(String[] args) {
        n = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i][0] = sc.nextInt();
            a[i][1] = sc.nextInt();
            a[i][2] = sc.nextInt();
        }

        for (int i = 1; i <= n; i++) {
            // 转移,不能选前一天相同的
            f[i][0] = Math.max(f[i - 1][1], f[i - 1][2]) + a[i][0];
            f[i][1] = Math.max(f[i - 1][0], f[i - 1][2]) + a[i][1];
            f[i][2] = Math.max(f[i - 1][0], f[i - 1][1]) + a[i][2];
        }
        int res = 0;
        for (int i = 0; i < 3; i++) {
            res = Math.max(f[n][i], res);
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    boolean hasNext() {
        while (st == null || !st.hasMoreElements()) {
            String s = nextLine();
            if (s == null) {
                return false;
            }
            st = new StringTokenizer(s);
        }

        return true;
    }
}